#! coding = utf-8

import os, sys
from time import sleep
import logging
from sms.xmh import XiMaHuang
from sms.hy import HuoYun

class Sms(object):
    """ 短信服务 """
    def __init__(self):
        self.__api = self._get_api()

    def _get_api(self):
        """ 初始化短信接口 """
        SMS_API = "ximahuang"
        return HuoYun() if SMS_API == 'huoyun' else XiMaHuang()

    def get_phone(self):
        """ 获得手机号码 """
        return self.__api.get_phone()
        
    def get_sms(self, phone):
        """ 获得短信验证码 """
        return self.__api.get_sms(phone)

    def block_phone(self, phone):
        """ 拉黑一个号码 """
        return self.__api.block_phone(phone)

    def release_phone(self, phone):
        """ 释放一个号码 """
        return self.__api.release_phone(phone)